<?php
/**
 * 备货订单
 * (model)
 */
namespace App\Models\ProductStockup;

use App\Models\Basics\SysArea;
use App\Models\Product\ProductSku;
use Illuminate\Database\Eloquent\Model;

class StockupOrder extends Model {

    protected $table = 'product_stockup_order';

    protected $guarded = [];

    public static $_status = [
        1 => '已审核',
        2 => '已关闭',
    ];

    public static $_planStatus = [
        1 => '未计划',
        2 => '部分计划',
        3 => '完全计划',
    ];

    public static $_purStatus = [
        1 => '未下单',
        2 => '已下单',
        3 => '已关闭',
    ];

    public static $_reStatus = [
        1 => '未到货',
        2 => '部分到货',
        3 => '完全到货',
    ];

    public function detail(){
        return $this->hasMany(StockupOrderDetail::class, 'stockup_no', 'stockup_no');
    }

    public function area(){
        return $this->belongsTo(SysArea::class,'area_id');
    }

    public function sku(){
        return $this->belongsTo(ProductSku::class,'psku_id');
    }

}
